home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr26 / netprog.zip / NETPROG.TAR / net.s5 / streammod.c < prev    next >
C/C++ Source or Header  |  1989-12-17  |  670b  |  41 lines

  1. /*
  2.  * Determine which stream modules have been pushed onto a stream.
  3.  */
  4.  
  5. #include    <stdio.h>
  6. #include    <fcntl.h>
  7. #include    <tiuser.h>
  8. #include    <stropts.h>
  9. #include    <sys/conf.h>
  10.  
  11. main()
  12. {
  13.     doit("/dev/tcp");
  14.     doit("/dev/udp");
  15. }
  16.  
  17. doit(name)
  18. char    *name;
  19. {
  20.     int        tfd;
  21.     char        filename[FMNAMESZ + 1];
  22.     struct t_info    info;
  23.  
  24.     printf("stream = %s\n", name);
  25.     if ( (tfd = t_open(name, O_RDWR, &info)) < 0)
  26.         err_sys("can't open %s", name);
  27.  
  28.     for ( ; ; ) {
  29.         if (ioctl(tfd, I_LOOK, filename) < 0) {
  30.             err_ret("ioctl I_LOOK error");
  31.             break;
  32.         }
  33.  
  34.         printf("    module = %s\n", filename);
  35.  
  36.         if (ioctl(tfd, I_POP, (char *) 0) < 0)
  37.             err_sys("ioctl I_POP error");
  38.     }
  39.     fflush(stdout);
  40. }
  41.